package com.yex.modules.etcc.controller;

import com.yex.common.exception.RRException;
import com.yex.common.utils.PageUtils;
import com.yex.common.utils.R;
import com.yex.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/etcc/merchant")
public class MerchantController {

    @Autowired
    private UserService userService;

    @RequestMapping("index")
    public R index(@RequestParam Map<String, Object> params) {
        PageUtils pageUtils = userService.merchantPage(params);
        return R.ok().put("page", pageUtils);
    }

    @PostMapping("merchantGranted")
    public R merchantGranted(@RequestBody Long[] ids) {
        if (ids == null || ids.length == 0) throw new RRException("请选择用户");
        userService.merchantGranted(ids);
        return R.ok();
    }

}
